package com.renren.project.admin.exception;

import com.renren.project.core.exception.RRExceptionHandler;
import com.renren.project.db.utils.R;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.AuthorizationException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author liyang
 * @version 1.0.0
 * @ClassName GlobalExceptionHandler
 * @Description TODO
 * @createTime 17:03:00 2021/02/07
 */
@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler extends RRExceptionHandler {

    @ExceptionHandler(AuthorizationException.class)
    public R handleAuthorizationException(AuthorizationException e){
        log.error(e.getMessage(), e);
        return R.error("没有权限，请联系管理员授权");
    }
}
